package binarySearch;

/**
 * @author understand
 * @description:
 * @create 2025/5/18 23:47
 */
public class FindMin {
    public static void main(String[] args) {
        int[] nums = {3,4,5,1,2};
        System.out.println(findMin(nums));
    }
    public static int findMin(int[] nums) {
        int left = 0, right = nums.length-1;
        while (left < right){
            int mid = (left + right) / 2;
            if (nums[mid] > nums[right])
                left = mid + 1;
            else
                right = mid;
        }
        return nums[left];
    }
}
